package com.bdqn.day0917.controller;

import com.bdqn.day0917.entity.User;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * @Author:Corday
 * @Date:2021/09/17/10:21
 */
@Controller
//@RequestMapping("/user")
public class TestController {
//获取首页
    @RequestMapping("/index.html")
    public String goIndex(Map map){
        map.put("index","index");
        map.put("msg","人间正道是沧桑!");
        User user = new User(1001,"小红");
        map.put("user",user);
        //http://localhost:8080/templates/index/index.html
        List<User> list=new ArrayList<>();
        list.add(new User(1005,"小美"));
        list.add(new User(1006,"小江"));
        list.add(new User(1008,"小强"));
        list.add(new User(1009,"李江"));
        list.add(new User(1010,"高大山"));
        list.add(new User(1011,"金山"));
        map.put("users",list);
      return "index/index";
    }

}
